#include "exynos_4412.h"

//采用轮询方式检测Key3按键的状态，按一次按键LED2点亮，再次按下LED2熄灭

int main(){

	/*将GPX1_2设置成输入功能*/
	GPX1.CON = GPX1.CON & (~(0xF << 8)); 
	//控制LED2
	GPX2.CON = GPX2.CON & (~(0xF << 28)) | (1 << 28);
	/*点亮LED2*/
	GPX2.DAT = GPX2.DAT | (1 << 7);
	//创建掩码
	unsigned int mask = 1 << 7;
	
	while(1){
		/*判断GPX1_2引脚的状态，即判断按键是否按下*/
		if(!(GPX1.DAT & (1 << 2))){
			GPX2.DAT = GPX2.DAT ^ mask;
			/*等待松手*/
			while(!(GPX1.DAT & (1 << 2)));
		} else {
			
		}
	}
	return 0;
}

